const homeService = require("../services/home");

/**
 * GET 请求参数解析
 * @param {*} ctx
 */
async function getBannerList(ctx) {
    let id = ctx.query.id;
    let name = ctx.query.name;
    ctx.body = {
        id,
        name
    };
}

/**
 * POST 请求参数解析
 * @param {*} ctx
 */
async function saveAddress(ctx) {
    let params = ctx.request.body;
    console.log(params);
    ctx.body = params;
}

/**
 * 调用服务层接口
 * @param {*} ctx
 */
async function getGoodsList(ctx) {
    let ret = await homeService.getGoodsList();
    ctx.body = ret.data;
}

module.exports = {
    getBannerList,
    saveAddress,
    getGoodsList
};
